<template>
	<!-- 商品列表 -->
	<view class='goods_list'>
		<view class='goods_item' v-for='item in goods' :key='item.id' @click="navigator(item.id)">
			<image :src='item.host_image' ></image>
			<view class='price'>
				<text>¥{{item.present_price}}</text>
				<text>¥{{item.original_price}}</text>
			</view>
			<view class='name'>
				<text>
					{{item.goods_name}}
				</text>
			</view>
		</view>
	</view>
		
	
</template>

<script>
	export default {
		props: ['goods'],
		methods: {
			navigator(id){
				this.$emit('goodsItemCLick', id)
			}
		}
	}
</script>

<style lang='scss'>
	.goods_list{
		padding: 0 15rpx;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		.goods_item{
			background: #FFFFFF;
			width: 355rpx;
			margin: 10rpx 0;
			
			padding: 15rpx;			// 中间间隔
			box-sizing: border-box;	// 盒子不会被撑大
			
			image{
				width: 80%;
				height: 150px;
				
				// 图片居中
				display: block;
				margin: auto;
			}
			.price{
				color: $shop-color;
				font-size: 36rpx;
				margin: 15rpx 0 5rpx 0;
				text:nth-child(2){
					color: #CCCCCC;
					font-size: 30rpx;
					margin-left: 20rpx;
					text-decoration: line-through;
				}
			}
			.name{
				font-size: 32rpx;
				line-height: 50rpx;
				padding-bottom: 15rpx;
				padding-top: 10rpx;
				
			}
		}
	}
		
</style>
